package com.zz.Map.province;

import java.util.*;

public class Test {
    public static void main(String args[]){
        //1.定义一个Map集合存储全部的省份信息，其对应的城市信息
        Map<String, List<String>> map = new HashMap<>();

        List<String> cities1 = new ArrayList <>();
        Collections.addAll(cities1, "南京市", "苏州市", "扬州市");
        map.put("江苏省", cities1);

        List<String> cities2 = new ArrayList <>();
        Collections.addAll(cities2, "抚州市", "南昌市", "九江市");
        map.put("江西省", cities2);

        System.out.println(map);

        //获取对应省份的城市信息
        List<String> list = map.get("江西省");
        for (String city : list) {
            System.out.println(city);
        }

        //获取所有省份对应的城市信息
        map.forEach((p, c)->{
            System.out.println(p + "=>" + c);
        });
    }
}
